<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="java.util.List"%>
<%@ page import="org.dualr.litelog.entity.Photo"%>
<%@ page import="org.dualr.litelog.entity.Category"%>
<%@ page import="org.dualr.litelog.dao.CategoryDao"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Edit Photo - LiteLog Administration</title>
<style type="text/css">
	body {
		font-size: 12px;
	}
	h1{
	background: #EBF4D8;
	line-height: 28px;
	padding: 4px 0 0 1em;
	border-bottom: 1px solid #87A34D;
	color: green;
	font-size: 14px;
}
</style>
</head>

<body>
<h1>图片编辑</h1>
<%
	Photo photo = (Photo)request.getAttribute("photo");
%>
	<form action="../admin?entity=photo&option=edit" method="post">
		<input type="hidden" name="id" value="<%=photo.getId()%>"></input>
			标题:<input type="text" name="name" value="<%=photo.getName()%>"/><br/>
			<%
				List<Category> categoryList = CategoryDao.getInstance().getListByProperty("type","photo","string");
			%>
			类别:<select name="categoryId">
				<%
					if (categoryList.size() != 0){
						for(Category category : categoryList){
							if(photo.getCategoryId() == category.getId()){
								%>
								<option value="<%=category.getId()%>" selected="selected"><%=category.getName()%></option>
								<%
							}else{
							%>
							<option value="<%=category.getId()%>"><%=category.getName()%></option>
							<%
							}
						}
						
					}
				%>
			</select>
			<br/>
			描述:<textarea rows="4" cols="30" name="description"><%=photo.getDescription()%></textarea><br/>
			<input type="submit" value="保存"></input>
	</form>
	<img src="../photo?id=<%=photo.getId()%>"  border="0"></img>
</body>
</html>